package edu.vt.ece.rt.dstm.contention;

import edu.vt.ece.rt.dstm.Context;

public abstract class AbstractContentionPolicy {
	/**
	 * 
	 * @param context1
	 * @param context2
	 * @return	0	Contention solved and current context can continue safely
	 * 			n	Wait n milliseconds and retry
	 * 			-1	retry again
	 * @throws	TransactionException	Contention solved by aborting current context
	 */
	
	public static int conflicts = 0;
	
	public abstract int resolve(Context context1, Context context2);

	/**
	 * @param context
	 */
	public abstract void init(Context context);

	/**
	 * @param context
	 */
	public abstract void open(Context context);
}
